<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <include file="Public:jquery" />
        <script type="text/javascript" src="__PUBLIC__/js/jQuery/plugin/jquery.filestyle.js"></script>
        <include file="Public:dialog" />
        <include file="Public:ajaxupload" />
        <include file="Public:startapp" />
        <include file="Public:startmoo" />
        <script type="text/javascript">
            $(function(){
                inputFileStyle();
                
                $('select[name="type"]').change(function(){
					if ($(this).val() == 'url'){
						if ($("#custom_url_tr").length > 0){
							return false;
						}else{
							var chtml = '';
							chtml += '<tr id="custom_url_tr"><td width="12%" align="right" class="left_text">自定义URL地址</td><td align="left">';
							chtml += '<input type="text" name="url" class="input_text w480" id="custom_url_path" />';
							chtml += '</td></tr>';
							$("#custom_url").after(chtml);
							$("#set_banner").remove();
						}
					}else{
						$("#custom_url_tr").remove();
						if ($("#set_banner").length == 0){
							var banner = '';
							banner += '<tr id="set_banner"><td width="12%" align="right" class="left_text">分类Banner设置</td><td align="left">';
							banner += '<span class="file_d_Upload">';
							banner += '<input id="filedata" type="file" class="attText" name="filedata">';
							banner += '<button class="attButton" id="buttonUpload" onclick="return ajaxFileUpload();">上传文件</button></span></td></tr>';
							$("#nav_html").after(banner);
							inputFileStyle();
						}
					}
				});
				
				_checkpress('input[name="name"]');
				_checkpress('input[name="channel"]');
				$('form').submit(function(){
					if (_checkform('input[name="name"]','*分类名称必须填写') == false) return false;
					if (_checkform('input[name="channel"]','*分类唯一ID必须填写') == false) return false;
					if ( $('select[name="type"]').val() == '' ){
						if ($('select[name="type"]').hasClass('error_input') == false){
							$('select[name="type"]').addClass('error_input');
			    			$('select[name="type"]').after('<span class="error_info">*请选择分类类型！</span>');
						}
						return false;
					}
				});
				
				$('select[name="type"]').change(function(){
					if ( $(this).val() != '' ){
						$(this).removeClass('error_input');
						$(this).next('.error_info').remove();
					}
				});
            });
            
			function inputFileStyle () {
			  	$("input[type=file]").filestyle({
					image : "../Public/images/chk.png",
					imageheight : 25,
					imagewidth : 86,
					width : 260
				});
			}
            
        </script>
    </head>
    <body>
        <include file="Public:header" />
        
        <div class="layout">
            
            <include file="Public:position" />{$vo['name']}</div>
            
            <table class="warp" cellpadding="0" cellspacing="0">
                <tr>
                    <td class="sidebar" valign="top">
                        <include file="Public:sidebar" />
                    </td>
                    <td class="contents" valign="top">
                        
                        <div class="a_table">
                        <form action="__URL__/update" method="post">
							<input type="hidden" name="type" value="{$vo['type']}" />
							<input type="hidden" name="id" value="{$vo['id']}" />
							<input type="hidden" name="pid" value="{$vo['pid']}" />
							<input type="hidden" name="nav" value="{$vo['nav']}" />
							<table cellspacing="1" class="form_table">
								<tr>
									<td align="right" class="left_text">分类名称</td>
									<td align="left"><input type="text" name="name" id="name" value="{$vo['name']}" class="input_text w480" /></td>
								</tr>
								<tr>
									<td align="right" class="left_text">自定义模板</td>
									<td align="left"><input type="text" name="tpl" value="{$vo['tpl']}" class="input_text w280" /> *无需路径，无需后缀名，填写模板文件名即可</td>
								</tr>
								<tr>
									<td align="right" class="left_text">分类唯一标识</td>
									<td align="left"><input type="text" name="channel" class="input_text w280" value="{$vo.channel}" /> *</td>
								</tr>
								<tr>
									<td align="right" class="left_text">状态</td>
									<td align="left">
										<input type="radio" name="status" value="1"<eq name="vo.status" value="1" > checked="checked"</eq> /> 正常 &nbsp; 
										<input type="radio" name="status" value="0"<eq name="vo.status" value="0" > checked="checked"</eq> /> 隐藏
									</td>
								</tr>
								<php>if(!empty($vo['url'])){</php>
								<tr id="custom_url_tr">
									<td align="right" class="left_text">自定义URL地址</td>
									<td align="left"><input type="text" name="url" id="custom_url_path" value="{$vo['url']}" class="input_text" /></td>
								</tr>
								<php>}</php>
								<tr id="set_banner">
									<td align="right" class="left_text">分类Banner设置</td>
									<td align="left">
										<span class="file_d_Upload">
											<php>if (!empty($vo['banner'])){</php>
											<input id="filedata" type="file" class="attText" name="filedata" disabled="disabled" />
											<button class="attButton" id="buttonUpload" onclick="return ajaxFileUpload();" disabled="disabled">上传文件</button>
											<button class='attButton' id='removebanner' onclick="return removeFile(this,'{$cate["banner"]}');">删除Banner</botton>
											<php>}else{</php>
											<input id="filedata" type="file" class="attText" name="filedata" />
											<button class="attButton" id="buttonUpload" onclick="return ajaxFileUpload();">上传文件</button>
											<php>}</php>
										</span>
									</td>
								</tr>
								<php>if (!empty($vo['banner'])){</php>
								<tr id='banner_display'>
									<td></td>
									<td align='left'><img src='{$vo['banner']}' /><input type='hidden' name='banner' value='{$vo['banner']}' /></td>
								</tr>
								<php>}</php>
								<tr style="display:none;" id="loading">
									<td></td>
									<td align='left'><img src="../Public/images/loading.gif" /></td>
								</tr>
								<tr>
									<td align="right" class="left_text">分类关键字</td>
									<td align="left"><input name="keyword" type="text" class="input_text w480" value="{$vo.keyword}" /> (SEO)</td>
								</tr>
								<tr>
									<td align="right" class="left_text">分类描述</td>
									<td align="left"><textarea name="description" class="input_text" style="width: 600px; height:140px;">{$vo.description}</textarea> (SEO)</td>
								</tr>
								<tr>
									<td align="right" class="left_text"></td>
									<td align="left"><div class="submit_default_box"><input type="submit" class="submit_default" value="提交表单" /><span class="submit_default_icon" id="submit_icon"></span></div></td>
								</tr>
							</table>
						</form>
                        
                        </div>
                    </td>
                </tr>
            </table>
        </div>
        
        <include file="Public:footer" />
    </body>
</html>
